# file: Makefile	G. Moody	24 June 1989
#			Last revised: 20 December 2001
# `make' description file for the WFDB Programmer's Guide
#
# -----------------------------------------------------------------------------
# WFDB applications: programs for working with annotated signals
# Copyright (C) 2001 George B. Moody
#
# These programs are free software; you can redistribute them and/or modify
# them under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# These programs are distributed in the hope that they will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# these programs; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# You may contact the author by e-mail (george@mit.edu) or postal mail
# (MIT Room E25-505A, Cambridge, MA 02139 USA).  For updates to this software,
# please visit PhysioNet (http://www.physionet.org/).
# _____________________________________________________________________________
#
# This file is used with the UNIX `make' command to create and install on-line
# versions of the WFDB Programmer's Guide, and also to print it. Before using
# this file for the first time, check that the site-specific variables below
# are appropriate for your system.

# The WFDB Programmer's Guide guide documents the WFDB library.  It contains
# both tutorial and reference material, with many examples, that will be useful
# if you wish to develop your own application programs for reading, analyzing,
# or creating digitized, optionally annotated, recordings of signals.

# The most recent version of this guide is always available on PhysioNet
# (follow the links from http://www.physionet.org/physiotools/manuals.shtml).
# Use any web browser to read it.

# If you have the necessary formatting software, the WFDB Programmer's Guide
# can be produced in a wide variety of formats from the sources in in this
# directory.  Here is a brief list of available formats and the commands needed
# to produce them:

# printed copy	'make wpg-book' (requires troff, texi2dvi, dvips, & a printer)
# Windows help	'make wpg.hlp'  (requires makertf and hcrtf) [1]
# HTML		'make wpg.html' (requires texi2html and perl)
# info		'make wpg.info' (requires makeinfo or GNU emacs) [2]
# PDF		'make wpg.pdf'  (requires texi2dvi)
# PostScript	'make wpg.ps'   (requires texi2dvi and dvips)

# [1] 'makertf' is open-source, from http://makertf.sourceforge.net/; see this
# page for links to 'hcrtf'.  Since these programs run only under MS-Windows,
# it is not possible to generate 'wpg.hlp' except under MS-Windows (but it's
# not useful to do so except under MS-Windows, either).

# [2] The info files get installed into INFODIR (see below), which must be in
# your INFOPATH.  Once they have been installed, browse the guide from info (or
# from emacs after typing C-h i to enter the info system), by selecting `WFDB
# library' from the top-level menu.  Note that `make wpg.info' adds an entry
# for the Guide to the top-level `info' file ($INFODIR/dir).  If you install a
# GNU emacs update, this entry may disappear; to restore it, simply `make
# wpg.info' again.
# _____________________________________________________________________________
# file: version.def		G. Moody	24 May 2000
#				Last revised:	12 July 2010
# Each release of the WFDB Software Package is identified by a three-part
# version number, defined below.  Be sure to leave a single space before
# and after the "=" in each of the next three lines!
MAJOR = 10
MINOR = 5
RELEASE = 4
VERSION = $(MAJOR).$(MINOR).$(RELEASE)

# RPMRELEASE can be incremented if changes are made between official
# releases.  It should be reset to 1 whenever the VERSION is changed.
RPMRELEASE = 1

# VDEFS is the set of C compiler options needed to set version number variables
# while compiling the WFDB Software Package.
VDEFS = -DWFDB_MAJOR=$(MAJOR) -DWFDB_MINOR=$(MINOR) -DWFDB_RELEASE=$(RELEASE)

# WAVEVERSION is the WAVE version number.
WAVEVERSION = 6.11
# _____________________________________________________________________________

# Definitions generated by 'configure'

PACKAGE = wfdb-10.5.4
SRCDIR = "/home/k/ecg/third/wfdb-10.5.4"
LONGDATE = 24 September 2010
SHORTDATE = SEPTEMBER 2010
ARCH = i686-Linux
# _____________________________________________________________________________

# file: linux.def		G. Moody	31 May 2000
#				Last revised:   13 May 2010
# 'make' definitions for compiling the WFDB Software Package under Linux

# Choose a value for WFDBROOT to determine where the WFDB Software Package will
# be installed.  One of the following is usually a reasonable choice.
# Installing in /usr generally requires root permissions, but will be easiest
# for future software development (no special -I or -L options will be needed
# to compile software with the WFDB library, since the *.h files and the
# library will be installed in the standard directories).
WFDBROOT = /usr
# Installing in /usr/local usually requires root permissions.  On a multi-user
# system where it is desirable to keep the OS vendor's software separate from
# other software, this is a good choice.  Another common choice in such cases
# is /opt .
# WFDBROOT = /usr/local
# To install without root permissions, a good choice is to set WFDBROOT to the
# name of your home directory, as in the example below (change as needed).
# WFDBROOT = /home/frodo

# LC and LL are used to determine C compiler and linker options needed to
# enable NETFILES (code that allows applications linked to the WFDB library to
# read input from HTTP and FTP servers, in addition to the standard filesystem
# support available without NETFILES).  The WFDB library can use either
# libcurl (recommended) or libwww to provide NETFILES support.  To use libcurl,
# set LC to `curl-config --cflags` (note the backquotes) and LL to
# `curl-config --libs`.  Otherwise, to use libwww, set LC to
# `libwww-config --cflags` and LL to `libwww-config --libs`.  If neither
# libcurl nor libwww is available, LC and LL should be empty (and NETFILES
# will be disabled).
LC =
LL =

# BINDIR specifies the directory in which the applications will be installed;
# it should be a directory in the PATH of those who will use the applications.
BINDIR = $(WFDBROOT)/bin

# DBDIR specifies the name of a directory in which to install the contents
# of the `data' directory.
DBDIR = $(WFDBROOT)/database

# INCDIR specifies the name of a directory in which to install the WFDB
# library's #include <...> files.
INCDIR = $(WFDBROOT)/include

# INFODIR is the GNU info directory (optional, needed to `make info').
INFODIR = $(WFDBROOT)/share/info

# LIBDIR specifies the name of a directory in which to install the WFDB
# library.
LIBDIR = $(WFDBROOT)/lib

# MANDIR is the root of the man page directory tree.  On most systems, this is
# something like /usr/man or /usr/local/man (type 'man man' to find out).
MANDIR = $(WFDBROOT)/share/man

# PSPDIR specifies the name of a directory in which to install the PostScript
# prolog (*.pro) files from the 'app' directory.
PSPDIR = $(WFDBROOT)/lib/ps

# CC is the name of your C compiler.
CC = gcc

# CCDEFS is the set of C compiler options needed to set preprocessor variables
# while compiling the WFDB Software Package.  CCDEFS should always include
# VDEFS (the version definitions).  Under Linux, -fno-stack-protector is needed
# when compiling the WFDB Toolkit for Matlab;  it's harmless otherwise.
CCDEFS = $(VDEFS) -fno-stack-protector

# MFLAGS is the set of architecture-dependent (-m*) compiler options, which
# is usually empty.  See the gcc manual for information about gcc's -m options.
MFLAGS =

# CFLAGS is the set of C compiler options.  CFLAGS should always include
# CCDEFS.
CFLAGS = $(MFLAGS) -g -O $(CCDEFS) $(LC) -I$(INCDIR)

# LDFLAGS is appended to the C compiler command line to specify loading the
# WFDB library.
LDFLAGS = -L$(LIBDIR) -lwfdb $(LL)

# WFDBLIB is the name of the standard WFDB library.  In order to access it via
# `-lwfdb', WFDBLIB should be `libwfdb.a'.
WFDBLIB = libwfdb.a

# BUILDLIB is the command that creates the static WFDB library once its
# components have been compiled separately;  the list of *.o files that
# make up the library will be appended to BUILDLIB.
BUILDLIB = $(AR) $(ARFLAGS) $(WFDBLIB)

# PRINT is the name of the program used to produce listings (including any
# options for the desired formatting).
PRINT = lpr

# SETPERMISSIONS is the command needed to make the installed files accessible
# to those who will use them.  The value given below makes them readable by
# everyone, and writeable by the owner only.  (If you perform the installation
# as `root', `root' is the owner of the installed files.)
SETPERMISSIONS = chmod 644

# SETDPERMISSIONS is similarly used to make directories created during the
# installation accessible.
SETDPERMISSIONS = chmod 755

# SETLPERMISSIONS is the command needed to make the WFDB library usable by
# programs linked to it.
SETLPERMISSIONS = chmod 644

# SETXPERMISSIONS is the command needed to make the applications accessible.
SETXPERMISSIONS = chmod 755

# STRIP is the command used to compact the compiled binaries by removing their
# symbol tables.
STRIP = strip
# To retain the symbol tables for debugging, comment out the previous line, and
# uncomment the next line.
# STRIP = :

# ...........................................................................
# This section of definitions is used only when compiling WAVE, which is
# possible only if the XView and Xlib libraries and include files have been
# installed.

# OPENWINHOME specifies the root directory of the OpenWindows hierarchy.
# This is usually /usr/openwin.
OPENWINHOME = /usr/openwin

# OWINCDIR is the directory in which the `xview' directory containing XView
# *.h files is found.
OWINCDIR = $(OPENWINHOME)/include

# OWLIBDIR is the directory in which the XView library is found.
OWLIBDIR = $(OPENWINHOME)/lib

# XHOME specifies the root directory of the X11 hierarchy.
# This is usually /usr/X11R6 (or /usr/X11).
XHOME = /usr/X11R6

# XINCDIR is the directory in which the 'X11' directory containing X11 *.h
# files is found.  This is usually /usr/X11R6/include, although there is often
# a link connecting /usr/include/X11 to this directory.
XINCDIR = $(XHOME)/include

# XLIBDIR is the directory in which the X11 libraries are found.
XLIBDIR = $(XHOME)/lib

# WCFLAGS is the set of C compiler options to use when compiling WAVE.
WCFLAGS = $(CFLAGS) -I$(OWINCDIR) -I$(XINCDIR) -fno-stack-protector

# HELPOBJ can be set to "help.o" if you wish to recompile the XView spot help
# functions in "wave/help.c" (recommended under Linux).
HELPOBJ = help.o
# Otherwise, use the version in libxview by uncommenting the next line:
# HELPOBJ =

# WLDFLAGS is the set of loader options appended to the C compiler command line
# to specify loading the WFDB, XView, and Xlib libraries.
WLDFLAGS = $(LDFLAGS) -L$(OWLIBDIR) -L$(XLIBDIR) -lxview -lolgx -lX11
# Users of Red Hat Linux 5.0 or 5.1 (not later versions), use this instead:
# WLDFLAGS = $(LDFLAGS) -L$(XLIBDIR) $(OWLIBDIR)/libxview.a \
#  $(OWLIBDIR)/libolgx.a -lX11
# This setting avoids incompatibilities with the shared (dynamic) libraries.
# ...........................................................................

# `make' (with no target specified) will be equivalent to `make all'.
make-all:	all

# `make lib-post-install' should be run after installing the WFDB library.
lib-post-install:
	ranlib $(LIBDIR)/$(WFDBLIB)

lib-post-uninstall:
	echo "Nothing to be done for lib-post-uninstall"
# _____________________________________________________________________________
# file: Makefile.tpl		G. Moody	 24 May 2000
#				Last revised:    2 March 2006
# Change the settings below as appropriate for your setup.

# D2PARGS is a list of options for dvips.  Uncomment one of these to set the
# paper size ("a4" is most common except in the US and Canada):
# D2PARGS = -t a4
D2PARGS = -t letter

# T2DARGS is a list of options for texi2dvi.  Uncomment one of these to set the
# page size (the size of the printed area on the paper):
# T2DARGS = -t @afourpaper
T2DARGS = -t @letterpaper

# PDFTEXCFG is the name of a file containing parameter settings for pdftex
# (used by texi2dvi).  Choose the file corresponding to your paper size:
# PDFTEXCFG = pdftex.cfg-a4
PDFTEXCFG = pdftex.cfg-letter

# LN is a command that makes the file named by its first argument accessible
# via the name given in its second argument.  If your system supports symbolic
# links, uncomment the next line.
LN = ln -sf
# Otherwise uncomment the next line if your system supports hard links.
# LN = ln
# If your system doesn't support links at all, copy files instead.
# LN = cp

# If you wish to install the info (GNU hypertext documentation) files from this
# package, specify the commands needed to format them from the texinfo source
# files, and to install them so that 'info' and related utilities can find
# them.  If you have GNU 'makeinfo' and 'install-info' (preferred),
# uncomment the next two lines.
MAKEINFO = makeinfo --force --no-warn
INSTALLINFO = /sbin/install-info --info-dir=$(INFODIR) $(INFODIR)/wpg

# Otherwise, you can use GNU emacs to do the formatting, and standard utilities
# to install the info files, by uncommenting the next two lines.
# MAKEINFO = ./makeinfo.sh
# INSTALLINFO = $(MAKE) install-wpg.info

# PERL is the full pathname of your perl interpreter, needed for 'make htmlpg'.
PERL = /usr/bin/perl

# PSPRINT is the name of the program that prints PostScript files. If your
# printer is not a PostScript printer, see the GhostScript documentation to see
# how to do this (since the figure files are in PostScript form, it is not
# sufficient to use a non-PostScript dvi translator such as dvilj).
PSPRINT = lpr

# TROFF is the name of the program that prints UNIX troff files (needed to
# print the covers of the guide).  Use 'groff' if you have
# GNU groff (the preferred formatter).
TROFF = groff
# Use 'ptroff' if you have Adobe TranScript software.
# TROFF = ptroff
# Consult your system administrator if you have neither 'groff' nor 'ptroff'.
# Other (untested) possibilities are 'psroff', 'ditroff', 'nroff', and 'troff'.

# It should not be necessary to modify anything below this line.
# -----------------------------------------------------------------------------

.IGNORE:

all:	wpg.html wpg.ps wpg.pdf
	$(MAKE) INFODIR=../wpg/info INSTALLINFO=: wpg.info
	cp -p wpg.ps wpg.pdf ../wpg

install:
	@echo Nothing to install in wpg-src.

uninstall:
	rm -f ../wpg/*

# 'make wpg-book': print a copy of the WFDB Programmer's Guide
wpg-book:	wpg.ps
	cp wpg.cover wpgcover
	echo $(SHORTDATE) >>wpgcover
	echo .bp >>wpgcover
	$(TROFF) wpgcover >wpgcover.ps
	$(PSPRINT) wpgcover.ps
	$(PSPRINT) wpg.ps

# 'make wpg.hlp': format the WFDB Programmer's Guide as an MS-Windows help file
wpg.hlp:	wpg.tex
	makertf --hpj=wpg.hpj --output=wpg.rtf --force wpg.tex
	@echo Ignore any errors that appear above!
	hcrtf -o wpg.hlp -x wpg.hpj
	test -s WPG.HLP && mv WPG.HLP wpg.hlp
	rm -f wpg.rtf wpg.hpj wpg.ph

# 'make wpg.html': format the WFDB Programmer's Guide as HTML
wpg.html:	wpg.tex
	cp -p wpg.tex ../wpg
	cd ../wpg; texi2html -short_ext -menu -split_node wpg.tex
	cd ../wpg; if [ -d wpg ]; then mv wpg/* .; rmdir wpg; fi
	mv ../wpg/wpg.htm ../wpg/wpg_btoc.htm	# use top page as brief TOC
	rm -f ../wpg/wpg.tex
	./fixpg.sh ../wpg
	sed "s/LONGDATE/$(LONGDATE)/" <wpg.ht0 | \
	  sed "s/VERSION/$(VERSION)/" >../wpg/wpg.htm
	cd ../wpg; $(LN) wpg.htm index.html

# 'make wpg.info': format the WFDB Programmer's Guide as info files
wpg.info:	wpg.tex
	$(MAKEINFO) wpg.tex
	test -d $(INFODIR) || \
	 ( mkdir -p $(INFODIR); $(SETDPERMISSIONS) $(INFODIR) )
	cp wpg wpg-* $(INFODIR)
	$(SETPERMISSIONS) $(INFODIR)/wpg*
	rm -f wpg wpg-*
	$(INSTALLINFO)

# 'make install-wpg.info': install info entry (if install-info is unavailable)
install-wpg.info:	wpg.info
	test -s $(INFODIR)/dir || cp dir.top $(INFODIR)/dir
	grep -s wpg $(INFODIR)/dir >/dev/null || cat dir.wpg >>$(INFODIR)/dir

# 'make wpg.info.tar.gz': create a tarball of info files
wpg.info.tar.gz:	wpg.tex
	$(MAKEINFO) wpg.tex
	mv wpg wpg-* info
	tar cfv - info | gzip >info.tar.gz

# 'make wpg.pdf': format the WFDB Programmer's Guide as PDF
wpg.pdf:	wpg.tex
	sed 's/@-//g' <wpg.tex >wpg1.tex
	mv wpg1.tex wpg.tex
	rm -f wpg.aux wpg.idx wpg.ind wpg.toc
	cp $(PDFTEXCFG) pdftex.cfg
	texi2dvi --pdf $(T2DARGS) wpg.tex
	rm pdftex.cfg wpg.tex

# 'make pg.ps': format the WFDB Programmer's Guide as PostScript
wpg.ps:		wpg.tex
	rm -f wpg.aux wpg.idx wpg.ind wpg.toc
	texi2dvi $(T2DARGS) wpg.tex
	dvips $(D2PARGS) -o wpg.ps wpg.dvi

wpg.tex:	wpg0.tex
	sed 's/VERSION/$(VERSION)/' <wpg0.tex | \
	 sed 's/LONGDATE/$(LONGDATE)/' >wpg.tex

# 'make clean': remove intermediate and backup files
clean:
	rm -f info.tar.gz wpg wpg-* wpg.aux wpg.cp wpg.cps wpg.dvi wpg.fn \
	 wpg.fns wpg.ilg wpg.ky wpg.log wpg.pdf wpg.ps wpg.pg wpg.tex wpg.toc \
	 wpg.tp wpg.vr wpgcover wpgcover.ps *~ ../wpg/info/dir
